home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / CSMP Digests / csmp-v1-003.txt < prev    next >
Encoding:
Text File  |  1992-11-18  |  61.0 KB  |  1,691 lines  |  [TEXT/MPS ]

  1. C.S.M.P. Digest             Sun, 08 Mar 92       Volume 1 : Issue 3
  2.  
  3. Today's Topics:
  4.  
  5.     Compiled version of xlisp
  6.     Wanted: algorithm to calculate day-of-week from date
  7.     Problem with CheckedOutFiles Goodie for MPW
  8.     Programming with AppleTalk (In n)
  9.     Making Folders invisible in Think C
  10.     C String Types
  11.     Sending an Apple Event with LaunchApplication...
  12.     Palettes (Help me get these colors!)
  13.     sqrt call using (in)SANE
  14.  
  15.  
  16. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  17.  
  18. These digests are available (by using FTP, account anonymous, your email
  19. address as password) in the pub/mac directory on ftp.cs.uoregon.edu.
  20. This is also the home of the comp.sys.mac.programmer Frequently Asked
  21. Questions list.
  22.  
  23. The articles in these digests are taken directly from comp.sys.mac.programmer.
  24. They are not edited; all articles included in this digest are in their original
  25. posted form.  The only articles that are -not- included in these digests are
  26. those which didn't receive any replies (except those that give information
  27. rather than ask a question).  All replies to each article are concatenated
  28. onto the original article in the order in which they were received.  Article
  29. threads are not added to the digests until the last article added to the
  30. thread is at least one month old (this is to ensure that the thread is dead
  31. before adding it to the digests).
  32.  
  33. Send administrative mail to mkelly@cs.uoregon.edu.
  34.  
  35. -------------------------------------------------------
  36.  
  37. From: mbp@generali.harvard.edu (Mark B Palmerino)
  38. Subject: Compiled version of xlisp
  39. Date: 24 Jan 92 18:55:12 GMT
  40. Organization: Harvard University, Cambridge, MA
  41.  
  42. Hi,
  43.  
  44. I just procured the sources for a program called xlisp and it has some
  45. support for building it for the mac. Some of the documentation that came
  46. with it suggests that someone has already done this. 
  47.  
  48. Before I spend alot of time making it work, I was wondering if anyone
  49. knows where I might be able to pick up a compiled version from internet.
  50.  
  51. Thanks much.
  52.  
  53. -- 
  54. Mark Palmerino      mbp@wjh12.harvard.edu       Voice: (617) 345-9500
  55.  
  56.  
  57.  
  58. - -------------------------
  59.  
  60. From: Thad.Humphries@p950.f70.n109.z1.FidoNet.Org (Thad Humphries)
  61. Subject: Compiled version of xlisp
  62. Date: 25 Jan 92 02:33:41 GMT
  63.  
  64.  
  65.   MB> I just procured the sources for a program called xlisp and it has some
  66.  MB> support for building it for the mac. Some of the documentation that came
  67.  MB> with it suggests that someone has already done this. 
  68.  MB> 
  69.  MB> Before I spend alot of time making it work, I was wondering if anyone
  70.  MB> knows where I might be able to pick up a compiled version from internet.
  71.  
  72. Try stanford.edu (whatever they are).  Version 2.0 crashes on a IIci under 6.0.5 (okay on earlier models) but you need 2.1 if you've got the IIci, si, etc.
  73.  
  74.  * Origin: Quis custodiet ipsos custodes? (1:109/70.950)
  75.  
  76.  
  77.  
  78. ---------------------------
  79.  
  80. From: jcav@quads.uchicago.edu (JohnC)
  81. Subject: Wanted: algorithm to calculate day-of-week from date
  82. Date: 24 Jan 92 16:49:44 GMT
  83. Organization: The Royal Society for Putting Things on Top of Other Things
  84.  
  85. I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  86. Any pointers to efficient algorithms for doing so?  Is there a better
  87. newsgroup for posting questions of this sort?  Shouldn't there be a
  88. "comp.algorithms"?  Any help would be greatly appreciated.
  89.  
  90.  
  91. -- 
  92. John Cavallino                  |  EMail: jcav@midway.uchicago.edu
  93. University of Chicago Hospitals |         John_Cavallino@uchfm.bsd.uchicago.edu
  94. Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953
  95. B0 f++ c+ g+ k s+(+) e+ h- pv   |         Chicago, IL  60637
  96.  
  97.  
  98.  
  99. - -------------------------
  100.  
  101. From: ts@uwasa.fi (Timo Salmi)
  102. Subject:  Wanted: algorithm to calculate day-of-week from date
  103. Date: 25 Jan 92 20:32:35 GMT
  104. Organization: University of Vaasa, Finland
  105.  
  106. In article <1992Jan24.164944.13436@midway.uchicago.edu> jcav@midway.uchicago.edu writes:
  107. >I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  108. >Any pointers to efficient algorithms for doing so?  Is there a better
  109.  
  110. Try garbo.uwasa.fi:/pc/ts/tsfaq25.zip Frequently Asked Questions. 
  111.  
  112. "If you do not know how to go about getting this package you are
  113. welcome to email me for the prerecorded garbo.uwasa.fi instructions,
  114. Keith Petersen (w8sdz@wsmr-simtel20.army.mil) for SIMTEL20
  115. information, or Craig Warren (ccw@deakin.oz.au) for Oceanian garbo
  116. mirror information.  North American users are advised first to
  117. search on SIMTEL20 or its mirror wuarchive.wustl.edu.  Oceanian
  118. users are referred to rana.cc.deakin.oz.au (for recent files)."
  119.  
  120. ...................................................................
  121. Prof. Timo Salmi
  122. Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.87.1
  123. School of Business Studies, University of Vaasa, SF-65101, Finland
  124. Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun
  125.  
  126.  
  127.  
  128. - -------------------------
  129.  
  130. From: fcs@teal.csn.org (M. Scott Marcy)
  131. Subject:  Wanted: algorithm to calculate day-of-week from date
  132. Date: 26 Jan 92 01:26:02 GMT
  133. Organization: Colorado SuperNet, Inc.
  134.  
  135. In article <1992Jan24.164944.13436@midway.uchicago.edu> jcav@midway.uchicago.edu writes:
  136. >I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  137. >Any pointers to efficient algorithms for doing so?  Is there a better
  138. >newsgroup for posting questions of this sort?  Shouldn't there be a
  139. >"comp.algorithms"?  Any help would be greatly appreciated.
  140.  
  141. /*****************************************************************************
  142. * day_of_week
  143. *
  144. * This routine calculates the day of the week for the given date.  It returns
  145. *   a number in the range of 0 to 6, with 0 = Saturday, 1 = Sunday,
  146. *   2 = Monday, etc.
  147. *
  148. * year     : the year as in 1991
  149. * month    : month number (1 = January, 2 = February, etc.)
  150. * day      : day number (one based)
  151. *****************************************************************************/
  152. short day_of_week(short year, short month, short day)
  153. {
  154. int     n;
  155.  
  156.     /* Get the "day number" */
  157.     n = year - 1900;
  158.     n += n / 4;
  159.     n += month_offset[month - 1];
  160.     n += day;
  161.  
  162.     /* If it's January of Februaru of a leap year, subtract one day */
  163.     if (month <= 2 && year % 4 == 0 &&
  164.             (year % 100 != 0 || year % 400 == 0))
  165.         n--;
  166.  
  167.     return n % 7;
  168. }
  169.  
  170. with month_offset defined as
  171.  
  172. short   month_offset[12] = {1,4,4,0,2,5,0,3,6,1,4,6};
  173.  
  174. This particular function only works for dates > 1900.
  175.  
  176. Hope this helps!
  177.  
  178.  
  179. >
  180. >
  181. >-- 
  182. >John Cavallino                  |  EMail: jcav@midway.uchicago.edu
  183. >University of Chicago Hospitals |         John_Cavallino@uchfm.bsd.uchicago.edu
  184. >Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953
  185. >B0 f++ c+ g+ k s+(+) e+ h- pv   |         Chicago, IL  60637
  186. -- 
  187. M. Scott Marcy                            Internet:  fcs@csn.org
  188. First Class Systems, Inc.                 Applelink: GBI.DEV
  189. PO Box 50005
  190. Colorado Springs, CO  80949 USA           Disclaimer: I own the company!
  191.  
  192.  
  193.  
  194. - -------------------------
  195.  
  196. From: mbabramowicz@amherst.edu
  197. Subject:  Wanted: algorithm to calculate day-of-week from date
  198. Date: 26 Jan 92 11:42:28 GMT
  199. Organization: Amherst College, Amherst, MA.
  200.  
  201. In article <1992Jan24.164944.13436@midway.uchicago.edu>, jcav@quads.uchicago.edu (JohnC) writes:
  202. > I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  203. > Any pointers to efficient algorithms for doing so?  Is there a better
  204. > newsgroup for posting questions of this sort?  Shouldn't there be a
  205. > "comp.algorithms"?  Any help would be greatly appreciated.
  206. > -- 
  207. > John Cavallino                  |  EMail: jcav@midway.uchicago.edu
  208. > University of Chicago Hospitals |         John_Cavallino@uchfm.bsd.uchicago.edu
  209. > Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953
  210. > B0 f++ c+ g+ k s+(+) e+ h- pv   |         Chicago, IL  60637
  211.  
  212. If you are using a Mac, the feature is almost built in. First,
  213. fill in the fields of a DateTimeRec, ignoring fields like
  214. dayOfWeek. Then use the following code:
  215.  
  216. Date2Secs(myDateTimeRec,mySecs);
  217. Secs2Date(mySecs,myDateTimeRec);
  218.  
  219. Note: mySecs should be of type LongInt
  220.  
  221. When you finish executing the code, the dayOfWeek field of myDateTimeRec
  222. will be properly filled in: it is ignored in the Date2Secs call but
  223. set in the Secs2Date call. Of course, this will only work for a limited
  224. span of years... If you need to figure out days of week over a longer
  225. period of time, you'll have to get a real algorithm. Years ago, I 
  226. figured one out and memorized it so I could tell days of week quickly
  227. for dates, but, alas, it didn't end up really impressing people that
  228. much, so I forgot it. If you do get an algorithm, I'd appreciate it
  229. if you'd send it to me; I'm curious.
  230.  
  231. Thanks,
  232. Michael
  233.  
  234.  
  235.  
  236. - -------------------------
  237.  
  238. From: mmalson@x102c.ess.harris.com (Mark Malson)
  239. Subject:  Wanted: algorithm to calculate day-of-week from date
  240. Date: 27 Jan 92 17:32:01 GMT
  241. Organization: Harris Corporation, GCSD, Melbourne, FL
  242.  
  243. In article <1992Jan24.164944.13436@midway.uchicago.edu>, jcav@quads.uchicago.edu (JohnC) writes:
  244. > I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  245. > Any pointers to efficient algorithms for doing so?  Is there a better
  246. > newsgroup for posting questions of this sort?  Shouldn't there be a
  247. > "comp.algorithms"?  Any help would be greatly appreciated.
  248. I use Zellar's algorithm - learned it from my Computer teacher in high
  249. school - 1978? I'd be interested if anyone has ever seen this in print,
  250. because I seem to be the only one I know who knows it. Anway, here it is:
  251.  
  252. g = ( int(2.6*m - .2) + d + y + int(y/4) + int(c/4) - 2*c) mod 7
  253.  
  254. Where:
  255.      g = day of week: 0 = Sunday, 6 = Saturday
  256.  
  257.      m = month-2, NOTE: 1 = MARCH, 2 = APRIL, 3 = MAY, etc.
  258.                         11 = JANUARY, 12 = FEBRUARY
  259.      y = year mod 100 (i.e., 00-99). y must be decremented from
  260.          actual year in case of January or February!
  261.      d = day of month (1-31)
  262.      c = century, or int(year/100). Same rule applies to c as to y, above.
  263.      int(x) = integer portion of x, truncated.
  264.      a mod b = modulo operation.
  265.  
  266. Example:
  267.     January 1, 1992:
  268.     m = 11, d = 1, y = 91, c = 19
  269.  
  270. g = ( int(2.6*m - .2) + d + y  + int(y/4)  + int(c/4)  - 2*c  ) mod 7
  271.   = ( int(2.6*11 -.2) + 1 + 91 + int(91/4) + int(19/4) - 2*19 ) mod 7
  272.   = ( int(28.6-.2)    + 1 + 91 + int(22.75)+ int(4.75) - 38   ) mod 7
  273.   = ( int(28.4)       + 1 + 91 + 22        + 4         - 38   ) mod 7
  274.   = ( 28              + 1 + 91 + 22        + 4         - 38   ) mod 7
  275.   =   108 mod 7
  276.   =   3 (Wednesday)
  277.  
  278. Here's some C code to implement it. Note the use of default truncation
  279. of integer division results. Also note that the result of the large
  280. equation could be negative. The mod operator sometimes returns a negative
  281. number if it is given a negative number, so you have to add 7 in that case.
  282.  
  283. int Zellar (int month, int day, int year)
  284. {
  285.     int     cent,
  286.             g;
  287.  
  288.     if ((month -= 2) < 1)
  289.     {
  290.         month += 12;
  291.         year--;
  292.     }
  293.     cent = year / 100;
  294.     year %= 100;
  295.     g = ((26 * month - 2)/10 + day + year + year/4 + cent/4 - 2*cent) % 7;
  296.     if (g<0) g += 7;    /* adjust for possible neg result from % opr */
  297.     return g;
  298. }
  299.  
  300. Here's a something I use almost as much to calculate the number of days
  301. in a month. It just figures out what DAY the first of the NEXT month is,
  302. and figures out what the 28th of THIS month is, and from that can figure
  303. out how many days in between those. May not the most efficient way to
  304. do it, but it ensures that any month that Zellar says is a "leap" month
  305. will be reported correctly.
  306.  
  307. int DaysPerMonth (int month, int year)
  308. {
  309.     int     lastDOW,
  310.             first,
  311.             diff;
  312.  
  313.     lastDOW = Zellar (month, 28, year);
  314.     if (++month > 12)
  315.     {
  316.         month = 1;
  317.         year++;
  318.     }
  319.     first = Zellar (month, 1, year);
  320.     diff = (first - lastDOW) % 7;
  321.     if (diff<0)  diff += 7;      /* adjust for possible neg % result */
  322.     return (diff + 27);
  323. }
  324.  
  325. Aside: Many people just want to compute leap years and can't remember the
  326. rule for what even centuries are and aren't leap years.  If you're only
  327. dealing with present and future dates, simply checking to see if the year
  328. is divisible by 4 will work until March 1, 2100. 2000 WILL BE a leap year.
  329. Otherwise, I just use DaysPerMonth above.
  330.  
  331. NOTE: None of these algorithms work correctly on dates before some time
  332. in 1752. They took out some days during that year to adjust for centuries
  333. of extra leap days or something like that. Anyway, if there is any chance
  334. of that, I always check to see if the year is >= 1753.
  335.  
  336. - Mark Malson
  337.   Staff Engineer
  338.   Harris Corporation
  339.   Government Communication Systems Division
  340.   P.O. Box 91000
  341.   Melbourne, FL  32902
  342.  
  343.   mmalson@x102c.ess.harris.com
  344.   mmalson@m22af.ess.harris.com
  345.  
  346.  
  347.  
  348. - -------------------------
  349.  
  350. From: phillips@grafted.UUCP (Mike Phillips)
  351. Subject:  Wanted: algorithm to calculate day-of-week from date
  352. Date: 27 Jan 92 21:37:29 GMT
  353. Organization: GRAFTED, Central Indiana's Usenet BBS 317-881-4369
  354.  
  355. jcav@quads.uchicago.edu (JohnC) writes:
  356.  
  357. > I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  358. > Any pointers to efficient algorithms for doing so?  Is there a better
  359. > newsgroup for posting questions of this sort?  Shouldn't there be a
  360. > "comp.algorithms"?  Any help would be greatly appreciated.
  361.  
  362.   Check out alt.cobol where a DOW algorithm was just posted in the last 
  363. two or three days.  It's generic, taken out of DDJ (Doctor Dobbs Journal)
  364.  
  365.  
  366. --
  367. Mike Phillips
  368. The Grafted Branch BBS
  369. 317-881-4369
  370. internet: phillips@grafted.UUCP
  371. uucp: ..!uunet!grafted.UUCP!phillips
  372.     -= newsfeeds available, contact robert@towers.rn.com =-
  373.  
  374.  
  375.  
  376. - -------------------------
  377.  
  378. From: plogan@mentorg.com (Patrick Logan)
  379. Subject:  Wanted: algorithm to calculate day-of-week from date
  380. Date: 27 Jan 92 20:33:56 GMT
  381. Organization: Mentor Graphics Corporation
  382.  
  383. In article <1992Jan27.173201.3568@trantor.harris-atd.com> mmalson@x102c.ess.harris.com (Mark Malson) writes:
  384.    In article <1992Jan24.164944.13436@midway.uchicago.edu>, jcav@quads.uchicago.edu (JohnC) writes:
  385.    > 
  386.    > I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  387.    > Any pointers to efficient algorithms for doing so?  Is there a better
  388.    > newsgroup for posting questions of this sort?  Shouldn't there be a
  389.    > "comp.algorithms"?  Any help would be greatly appreciated.
  390.    > 
  391.    I use Zellar's algorithm - learned it from my Computer teacher in high
  392.    school - 1978? I'd be interested if anyone has ever seen this in print,
  393.    because I seem to be the only one I know who knows it. Anway, here it is:
  394.  
  395.    [Example deleted]
  396.  
  397. Zellar's Congruence is in _The T Programming Language: A Dialect of
  398. Lisp_ by Stephen Slade. I have a draft dated June 25, 1986. I think it
  399. was published in book form a year or two later. By who I do not know.
  400.  
  401. The reference Slade gives is _Artificial Intelligence Programming_ by
  402. Charniak, Riesbeck, and McDermott, Lawrence Erlbaum Associates,
  403. Hillsdale, NJ, 1980. I used to have that, but no longer do.
  404. -- 
  405. Patrick Logan, plogan@mentorg.com,
  406. Voice: (503) 685-7000 x2907, FAX: (503) 685-1282
  407. Mentor Graphics Corp., Bldg. C, 8005 SW Boeckman Rd., Wilsonville, OR 97070
  408. I can't gete the .signature virus and I can't gete the .signature
  409.  
  410.  
  411.  
  412. - -------------------------
  413.  
  414. From: dsmall@mitre.org (Duane W. Small)
  415. Subject:  Wanted: algorithm to calculate day-of-week from date
  416. Date: 28 Jan 92 17:40:39 GMT
  417. Organization: The MITRE Corporation
  418.  
  419. In article <1992Jan27.173201.3568@trantor.harris-atd.com>, mmalson@x102c.ess.harris.com (Mark Malson) writes:
  420. > In article <1992Jan24.164944.13436@midway.uchicago.edu>, jcav@quads.uchicago.edu (JohnC) writes:
  421. > > 
  422. > > I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  423. > > ...
  424.  
  425. > I use Zellar's algorithm - learned it from my Computer teacher in high
  426. > school - 1978? I'd be interested if anyone has ever seen this in print,
  427. > because I seem to be the only one I know who knows it. Anway, here it is:
  428. > g = ( int(2.6*m - .2) + d + y + int(y/4) + int(c/4) - 2*c) mod 7
  429. > Where:
  430. >      g = day of week: 0 = Sunday, 6 = Saturday
  431. >      m = month-2, NOTE: 1 = MARCH, 2 = APRIL, 3 = MAY, etc.
  432. >                         11 = JANUARY, 12 = FEBRUARY
  433. >      y = year mod 100 (i.e., 00-99). y must be decremented from
  434. >          actual year in case of January or February!
  435. >      d = day of month (1-31)
  436. >      c = century, or int(year/100). Same rule applies to c as to y, above.
  437. >      int(x) = integer portion of x, truncated.
  438. >      a mod b = modulo operation.
  439. >...
  440.  
  441. A somewhat more general algorithm uses the Julian day number (jdn):
  442.  
  443. jdn = 367*year + int(275*month/9) - int(7*(year+int((month+9)/12))/4) 
  444.       - int(3*(1+int((year+int((month-9)/7))/100))/4) + day + 1721029
  445.  
  446. Months are numbered from 1 (January) to 12 (December).  The terms
  447. (month+9)/12 and (month-9)/7 eliminate the need to start from March 1
  448. and renumber the years.  A quick analysis is
  449.  
  450.      367 days per year
  451.      30 or 31 days per month (only February is incorrect)
  452.      less 2 days per year (except 1 in leap years) at the end of February
  453.      less 1 day at the turn of each century (when leap year is skipped),
  454.            except once every four centuries (when it isn't skipped)--
  455.            again at the end of February
  456.      plus the day of the month
  457.      plus a constant to create a starting date of January 1, 4712 BC
  458.  
  459. (No, I don't know why that starting date was chosen.)
  460.  
  461. The day of the week is jdn mod 7, with Monday = 0 and Sunday = 6.
  462.  
  463. I obtained the formula from a March 1988 posting by Walter Nissen 
  464. (ZZI%NIHCU.BITNET@CUNYVM.CUNY.EDU) in an IBM PC newsgroup.  He appeared to
  465. attribute it to "The Explanatory Supplement to the Astronomical Ephemeris 
  466. and the American Ephemeris and Nautical Almanac prepared by the Nautical
  467. Almanac Offices of the United Kingdom and the USA."
  468.  
  469. One obvious use of the formula is to compute the difference in days between
  470. two dates as jndlater - jdnearlier.  Nissen claimed that the jdn has "many
  471. desirable properties," suggesting other uses (and perhaps accounting for
  472. the rather odd starting date?), but he did not elaborate.  He did cite the
  473. Explanatory Supplement (he thought out of print, but available in libraries)
  474. as a good source of calendrical information.
  475.  
  476.  
  477.  
  478. - -------------------------
  479.  
  480. From: cek@sdc.boeing.com (Conrad Kimball)
  481. Subject:  Wanted: algorithm to calculate day-of-week from date
  482. Date: 2 Feb 92 05:20:34 GMT
  483. Organization: Boeing Computer Services (ESP), Seattle, WA
  484.  
  485. In article <1992Jan24.164944.13436@midway.uchicago.edu> jcav@midway.uchicago.edu writes:
  486. >I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  487. >Any pointers to efficient algorithms for doing so?  Is there a better
  488. >newsgroup for posting questions of this sort?  Shouldn't there be a
  489. >"comp.algorithms"?  Any help would be greatly appreciated.
  490.  
  491. Check out the Collected Algorithms of the ACM.  This is a multiple-volume
  492. collection of algorithms put together by the Association for Computing
  493. Machinery (ACM).  I don't remember which volume it's in, but there is just
  494. such an algorithm that you are looking for (I've used it in the past).
  495. -- 
  496. --
  497. Conrad Kimball          Boeing Computer Services     (206) 865-6410   
  498. Email: cek@sdc.boeing.com or cek%sdc@atc.boeing.com
  499. UUCP:  uw-beaver!bcsaic!sdc!cek
  500.  
  501.  
  502.  
  503. - -------------------------
  504.  
  505. From: rmitchel@bbn.com (Rob Mitchell)
  506. Subject:  Wanted: algorithm to calculate day-of-week from date
  507. Date: 5 Feb 92 12:55:11 GMT
  508.  
  509. cek@sdc.boeing.com (Conrad Kimball) writes:
  510.  
  511. >In article <1992Jan24.164944.13436@midway.uchicago.edu> jcav@midway.uchicago.edu writes:
  512. >>I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  513. >>Any pointers to efficient algorithms for doing so?  Is there a better
  514. >>newsgroup for posting questions of this sort?  Shouldn't there be a
  515. >>"comp.algorithms"?  Any help would be greatly appreciated.
  516.  
  517. >Check out the Collected Algorithms of the ACM.  This is a multiple-volume
  518. >collection of algorithms put together by the Association for Computing
  519. >Machinery (ACM).  I don't remember which volume it's in, but there is just
  520. >such an algorithm that you are looking for (I've used it in the past).
  521.  
  522.     Check this out ...
  523.  
  524.     DateTimeRec    dtRec;
  525.     long           secs;
  526.  
  527.  
  528.     dtRec.year    = "your year";  /* 1904 ... 2040 */
  529.     dtRec.month   = "your month"; /* 1=Jan .. 12=Dec */
  530.     dtRec.day     = "your day";   /* 1 .. 31 */
  531.     dtRec.hour    = "your hour";  /* 0 .. 23 */
  532.     dtRec.minute  = "your minute; /* 0 .. 59 */
  533.     dtRec.second  = "your second";/* 0 .. 59 */
  534.     /* dtRec.dayOfWeek not used *//* 1=Sun .. 7=Sat */
  535.  
  536.     Date2Secs (&dtRec, &secs);  /* receives "raw" secods since 1/1/1904 */
  537.     Secs2Date (secs, &dtRec);   /* receives corresponding date and time */
  538.  
  539.     /* Now check out the dtRec.dayOfWeek and use its value */
  540.  
  541.  
  542.     Disclaimer: never compiled or tested the above code, but it should
  543.     work reasonably well.
  544.  
  545.  
  546.     Later.
  547.  
  548. Rob Mitchell                  (rmitchel@bbn.com)                  617-873-4041
  549. Macintosh and Unix Software Engineer
  550. These opinions are mine and mine only.
  551.  
  552.  
  553.  
  554. - -------------------------
  555.  
  556. From: jxs18@po.CWRU.Edu (Jerry Sy)
  557. Subject:  Wanted: algorithm to calculate day-of-week from date
  558. Date: 5 Feb 92 13:55:56 GMT
  559. Organization: Case Western Reserve University, Cleveland, OH (USA)
  560.  
  561.  
  562. In a previous article, cek@sdc.boeing.com (Conrad Kimball) says:
  563.  
  564. >In article <1992Jan24.164944.13436@midway.uchicago.edu> jcav@midway.uchicago.edu writes:
  565. >>I need to determine the day of the week (Sunday,Monday,etc) of a given date.
  566. >>Any pointers to efficient algorithms for doing so?  Is there a better
  567. >>newsgroup for posting questions of this sort?  Shouldn't there be a
  568. >>"comp.algorithms"?  Any help would be greatly appreciated.
  569. >
  570. >Check out the Collected Algorithms of the ACM.  This is a multiple-volume
  571. >collection of algorithms put together by the Association for Computing
  572. >Machinery (ACM).  I don't remember which volume it's in, but there is just
  573. >such an algorithm that you are looking for (I've used it in the past).
  574. >-- 
  575. >--
  576. >
  577. that is the theoretical way, the practical way (which I have always used)
  578. is just two steps.
  579.  
  580. covert your date into raw seconds format using Date2Secs(..)
  581. and then convert the raw seconds into the long date format using
  582. IUDateString(..), then just extract the day of week out using your
  583. regular string functions.
  584.  
  585. jerry
  586.  
  587.  
  588.  
  589. ---------------------------
  590.  
  591. From: xerox@coos.dartmouth.edu (Jamie Osborne)
  592. Subject: Problem with CheckedOutFiles Goodie for MPW
  593. Date: 24 Jan 92 21:58:07 GMT
  594. Organization: Dartmouth College, Hanover, NH
  595.  
  596. I am trying to use the CheckedOutFiles script, written by scott douglass and
  597. Darin Adler, that was included in the Goodies stuff for MPW.  I have not
  598. been able to get it to work, and it seems that the problem lies in a regexp
  599. that is used in the script.  I've fiddled with it alot, but I was hoping that
  600. someone might have a working version of the script, and wouldn't mind emailing
  601. it to me.  Here is a dump of how the script progresses when I run it.
  602. Unfortunately, the control characters can not be displayed correctly here.
  603.  
  604. Thanks!
  605. -J
  606. - --------------
  607.  
  608.   If 1 ... End
  609.    Set somewhere "\B7\\B7\ 'Intrepid:DEVELOP:MPW:Worksheet'"
  610.    Else
  611.    end
  612.   Set FirstNotOpened ""
  613.   Set OthersNotOpened ""
  614.   Begin ... End \B7\\B7\ 'Intrepid:DEVELOP:MPW:Worksheet'
  615.     CheckedOutFiles -m
  616.      Alias UsageError 'Alert ""{0} {Parameters}" doesn't make sense.\B6\nUsage:
  617. "{0} [-project project | -m]"" ; Exit 1'
  618.      Set Exit 0
  619.      Begin ... End
  620.       Set Options ""
  621.       Set Project ""
  622.       If 1 == 2 && "-m" =~ /-project/ ... End
  623.        Else If 1 == 1 && "-m" =~ /-m/
  624.        If == "" ... End
  625.         Set Options "-m"
  626.         Else
  627.         end
  628.        Else If 1 <> 0
  629.        end
  630.        CheckOutDir -r -m
  631.        Set CheckOutDirStatus 0
  632.        Echo
  633.       Set CheckOutDirs "CheckOutDir -project temp\BA\ -x "
  634.       If 0 ... End
  635.        end
  636.       Loop ... End
  637.        Break If "CheckOutDir -project temp\BA\ -x " !~ / *CheckOutDir +-project
  638. \B6\'<<0,1>>([\C2\:]+\BA\)(R)1\B6\'<<0,1>>
  639. \B6\'<<0,1>>([\C2\\BA\]*:)(R)2\B6\'<<0,1>> (\C5\)(R)3/
  640.        end
  641.       If "CheckOutDir -project temp\BA\ -x " <> "" ... End
  642.        Echo "### CheckedOutFiles - Couldn't parse CheckOutDirs: CheckOutDir
  643. -project temp\BA\ -x " > Dev:StdErr
  644. ### CheckedOutFiles - Couldn't parse CheckOutDirs: CheckOutDir -project
  645. temp\BA\ -x
  646.        Exit 1
  647.    For File In ... End
  648.     end
  649.    If "" <> "" ... End
  650.     end
  651.    end
  652.  
  653. --
  654. Jamie Osborne                    | email: Jamie.Osborne@dartmouth.edu
  655. Student (ENGL && CS)/ Programmer | Disclaimer:I get paid for code, not opinions.
  656.  "The best thing you ever done for me is to help me take my life
  657.         less seriously.  It's only life, after all."  -Indigo Girls
  658.  
  659.  
  660.  
  661. - -------------------------
  662.  
  663. From: xerox@coos.dartmouth.edu (Jamie Osborne)
  664. Subject:  Problem with CheckedOutFiles Goodie for MPW
  665. Date: 24 Jan 92 22:57:58 GMT
  666. Organization: Dartmouth College, Hanover, NH
  667.  
  668. xerox@coos.dartmouth.edu (Jamie Osborne) writes:
  669.  
  670. >I am trying to use the CheckedOutFiles script, written by scott douglass and
  671. >Darin Adler, that was included in the Goodies stuff for MPW.  I have not
  672. >been able to get it to work, and it seems that the problem lies in a regexp
  673. >that is used in the script.  I've fiddled with it alot, but I was hoping that
  674. >someone might have a working version of the script, and wouldn't mind emailing
  675. >it to me.  Here is a dump of how the script progresses when I run it.
  676. >Unfortunately, the control characters can not be displayed correctly here.
  677.  
  678. >Thanks!
  679. >-J
  680. >----------------
  681.  
  682. >---- Stuff deleted
  683.  
  684.     I discovered the problem, but I don't think that it's anything that
  685. I can fix on any serious basis.  Here's what part of the CheckedOutFiles script
  686. looks like:
  687.  
  688.     Set CheckOutDirs "`CheckOutDir -r {Options} {Project}; Set
  689. CheckOutDirStatus {Status}; Echo`"
  690.     If {CheckOutDirStatus}
  691.         Echo "### {0} - CheckOutDir failed." > Dev:StdErr
  692.         Exit 1
  693.     End
  694.  
  695.     Loop
  696.         Break If "{CheckOutDirs}" !~ / *CheckOutDir +-project
  697. \B6\'<<0,1>>([\C2\:]+\BA\)(R)1\B6\'<<0,1>>
  698. \B6\'<<0,1>>([\C2\\BA\]*)(R)2\B6\'<<0,1>> (\C5\)(R)3/
  699.         Set Project "{(R)1}"
  700.         Set CheckOutDir ":"
  701.         Set CheckOutDirs "{(R)3}"
  702.  
  703.  
  704.     The first thing it does is set the value of CheckOutDirs by using the
  705. -r flag.  According to the MPW Commando, if no check out directory is specified
  706. the current check out directories will be written to standard output in the 
  707. form of another CheckOutDir command.  If you look at the Break If... line,
  708. you'll see that the regexp depends on this for the second variable that it
  709. sets.  It requires : to be the last character in the word.
  710.     Unfortunately, it seems that CheckOutDir does not do this.  Instead, it
  711. writes out a -x parameter (eg. CheckOutDir -project temp\BA\ -x).  This says to
  712. reset the checkout directory to the default.  Because the script at the Break
  713. if... line depends on the directory name being there, and not the -x, it fails.
  714.     I solved this, for the time being, by requiring that you be in the
  715. check out directory before executing the opencheckedoutfiles command.  Notice
  716. that I set the value of CheckOutDir to the current directory.
  717.  
  718.     If anyone has a more robust and correct solution, I'd be very happy to
  719. see it.
  720.  
  721. Thanks.
  722. --
  723. Jamie Osborne                    | email: Jamie.Osborne@dartmouth.edu
  724. Student (ENGL && CS)/ Programmer | Disclaimer:I get paid for code, not opinions.
  725.  "The best thing you ever done for me is to help me take my life
  726.         less seriously.  It's only life, after all."  -Indigo Girls
  727.  
  728.  
  729.  
  730. ---------------------------
  731.  
  732. From: kai@dvpj.sony.co.jp (Masamitsu Kai)
  733. Subject: Programming with AppleTalk (In n)
  734. Date: 25 Jan 92 01:40:07 GMT
  735. Organization: Sony Corporation, PC Div. A Project Office, Tokyo Japan
  736.  
  737. I am beginner of Pascal Programming and studying AppleTalk. The reference
  738. book is "Macintosh Inside Out: Programming with AppleTalk".The example is
  739. "RemoteSysInfo: An RDEV/INIT Example Program".
  740.   (1)INIT
  741.   (2)RDEV
  742.   (3)ExEC
  743. I successed programming (1). But I didn't successe (2) and (3).
  744. Is there person who successed the programming ?
  745.  
  746. Thanks in advance.
  747.  
  748. - -----------------------------------------------------------------------
  749. Sony
  750. Masamitsu Kai
  751. E-Mail: kai@dvpj.sony.co.jp
  752.  
  753. -- 
  754.  
  755. Masamitsu Kai
  756. kai@dvpj.sony.co.jp
  757. (J
  758.  
  759.  
  760.  
  761. - -------------------------
  762.  
  763. From: peirce@outpost.SF-Bay.org (Michael Peirce)
  764. Subject:  Programming with AppleTalk (In n)
  765. Date: 26 Jan 92 04:01:44 GMT
  766. Organization: Peirce Software
  767.  
  768.  
  769. In article <12390@dvpjgw.dvpj.sony.co.jp> (comp.sys.mac.programmer), kai@dvpj.sony.co.jp (Masamitsu Kai) writes:
  770. > I am beginner of Pascal Programming and studying AppleTalk. The reference
  771. > book is "Macintosh Inside Out: Programming with AppleTalk".The example is
  772. > "RemoteSysInfo: An RDEV/INIT Example Program".
  773. >   (1)INIT
  774. >   (2)RDEV
  775. >   (3)ExEC
  776. > I successed programming (1). But I didn't successe (2) and (3).
  777. > Is there person who successed the programming ?
  778. > Thanks in advance.
  779.  
  780. Anyone who wants the source code can send me mail and I'll forward
  781. it to them.
  782.  
  783. --  Michael Peirce         --   peirce@outpost.SF-Bay.org
  784. --  Peirce Software        --   Suite 301, 719 Hibiscus Place
  785. --  Macintosh Programming  --   San Jose, California USA 95117
  786. --           & Consulting  --   voice: (408) 244-6554 fax: (408) 244-6882
  787. --                         --   AppleLink: peirce & America Online: AFC Peirce
  788.  
  789.  
  790.  
  791. ---------------------------
  792.  
  793. From: kacovert@miavx1.acs.muohio.edu
  794. Subject: Making Folders invisible in Think C
  795. Date: 24 Jan 92 19:54:28 GMT
  796. Organization: Miami University Academic Computer Service
  797.  
  798. I have written the following piece of code to toggle a file (in this example
  799. TEST) between being hidden and being visible.  I would like to do the same for
  800. directories, but have as of yet been unsuccessful.  Could someone please help? 
  801. An example would be great.  I would appreciate it if you could respond by mail. 
  802. I don't get a chance to read this newgroup very often.
  803.  
  804. #include <stdio.h>
  805. #include <Files.h>
  806. #include <pascal.h>
  807. main()
  808. {
  809.   int OSErr;
  810.   FInfo fndrInfo;
  811.     
  812.   if ((OSErr=GetFInfo("\pHard Disk:TEST",0,&fndrInfo)) != 0)
  813.   { printf("Error in getting TEST information: %d\n",OSErr); }
  814.   else
  815.   { fndrInfo.fdFlags = fndrInfo.fdFlags ^ fInvisible;
  816.     if ((OSErr=SetFInfo("\pHard Disk:TEST",0,&fndrInfo)) != 0)
  817.     { printf("Error in changing TEST: %d\n",OSErr); }
  818.     else
  819.     { if ((fndrInfo.fdFlags & fInvisible) == fInvisible)
  820.         printf("Control Panels is now invisible\n");
  821.       else
  822.         printf("Control Panels is now visible\n");
  823.     }
  824.   }
  825. }
  826.  
  827. Any help would be appreciated.
  828.  
  829. -- 
  830.                                      Kent Covert
  831.                                      Academic Computer Service
  832.                                      Miami University, Oxford, OH
  833.                                      kacovert@miavx1.aps.muohio.edu  (internet)
  834.                                      kacovert@miavx1                 (bitnet)
  835.  
  836.  
  837.  
  838. - -------------------------
  839.  
  840. From: kacovert@miavx1.acs.muohio.edu
  841. Subject:  Making Folders invisible in Think C
  842. Date: 25 Jan 92 17:01:26 GMT
  843. Organization: Miami University Academic Computer Service
  844.  
  845. In article <1992Jan24.145428.8653@miavx1.acs.muohio.edu>, kacovert@miavx1.acs.muohio.edu writes:
  846. > I have written the following piece of code to toggle a file (in this example
  847. > TEST) between being hidden and being visible.  I would like to do the same for
  848. > directories, but have as of yet been unsuccessful.  Could someone please help? 
  849. > An example would be great.  I would appreciate it if you could respond by mail. 
  850. > I don't get a chance to read this newgroup very often.
  851.  
  852. [program, etc. deleted...]
  853.  
  854. I apologize.  I gave the wrong address in my signature.  The following
  855. addresses should be correct.  Sorry for any confusion.
  856.  
  857. -- 
  858.                                      Kent Covert
  859.                                      Academic Computer Service
  860.                                      Miami University, Oxford, OH
  861.                                      kacovert@miavx1.acs.muohio.edu  (internet)
  862.                                      kacovert@miavx1                 (bitnet)
  863.  
  864.  
  865.  
  866. - -------------------------
  867.  
  868. From: buckeye@spf.trw.com (John Wallace)
  869. Subject:  Making Folders invisible in Think C
  870. Date: 31 Jan 92 02:27:49 GMT
  871. Organization: TRW Data Systems Center, Redondo Beach, CA
  872.  
  873. In article <1992Jan24.145428.8653@miavx1.acs.muohio.edu> kacovert@miavx1.acs.muohio.edu writes:
  874. >I have written the following piece of code to toggle a file (in this example
  875. >TEST) between being hidden and being visible.  I would like to do the same for
  876. >directories, but have as of yet been unsuccessful.  Could someone please help? 
  877. >An example would be great.  I would appreciate it if you could respond by mail. 
  878. >I don't get a chance to read this newgroup very often.
  879. >
  880. >#include <stdio.h>
  881. >#include <Files.h>
  882. >#include <pascal.h>
  883. >main()
  884. >{
  885. >  int OSErr;
  886. >  FInfo fndrInfo;
  887. >    
  888. >  if ((OSErr=GetFInfo("\pHard Disk:TEST",0,&fndrInfo)) != 0)
  889. >  { printf("Error in getting TEST information: %d\n",OSErr); }
  890. >  else
  891. >  { fndrInfo.fdFlags = fndrInfo.fdFlags ^ fInvisible;
  892. >    if ((OSErr=SetFInfo("\pHard Disk:TEST",0,&fndrInfo)) != 0)
  893. >    { printf("Error in changing TEST: %d\n",OSErr); }
  894. >    else
  895. >    { if ((fndrInfo.fdFlags & fInvisible) == fInvisible)
  896. >        printf("Control Panels is now invisible\n");
  897. >      else
  898. >        printf("Control Panels is now visible\n");
  899. >    }
  900. >  }
  901. >}
  902. >
  903.  
  904. This is not supported under System 6's Finder.  It does hide files marked
  905. as invisible, but it draws folders no matter what their invisible bit
  906. says.  However, you'll be happy to know that your code should work just 
  907. fine under System 7.
  908.  
  909. (If anyone knows how to trick Finder 6.x, it'd be neat to know.  The
  910. only way I can figure to do this is to tail-patch GetCatInfo, returning 
  911. information about the folder as if it was a file.  You could do this
  912. by setting its ioFlAttrib to 0 and then faking all of the other
  913. information.)
  914.  
  915. John
  916. -- 
  917. John Wallace              (buckeye@spf.trw.com)
  918. Phone: (213)812-7409    FAX: (213)812-8800
  919. TRW, One Space Park R2/2162, Redondo Beach, CA  90278
  920.  
  921.  
  922.  
  923. - -------------------------
  924.  
  925. From: stoodt@cis.umassd.edu (Michael Stoodt)
  926. Subject:  Making Folders invisible in Think C
  927. Date: 31 Jan 92 15:43:02 GMT
  928. Organization: University of Massachusetts Dartmouth
  929.  
  930. In <2988B425.2B52@deneva.sdd.trw.com> buckeye@spf.trw.com (John Wallace) writes:
  931.  
  932. >This is not supported under System 6's Finder.  It does hide files marked
  933. >as invisible, but it draws folders no matter what their invisible bit
  934. >says.  However, you'll be happy to know that your code should work just 
  935. >fine under System 7.
  936.  
  937. This does not appear to be correct.  We used to use Resedit to set the
  938. System Folder invisible on the Macintoshes in our labs, and and under
  939. 6.* Finder was perfectly happy not showing it.  Perhaps the Inited bit
  940. needs to be cleared as well, to let the Finder see that something's
  941. been changed?  (Now we're running System 7, where if you set the
  942. System Folder invisible you don't get anything in the Apple Menu...)
  943.  
  944. Michael Stoodt                                   stoodt@cis.umassd.edu
  945.  
  946.  
  947.  
  948. ---------------------------
  949.  
  950. From: am137@cleveland.Freenet.Edu (Martin Wojbor Woyczynski)
  951. Subject: C String Types
  952. Date: 25 Jan 92 19:41:57 GMT
  953. Organization: Case Western Reserve University, Cleveland, Ohio, (USA)
  954.  
  955.  
  956. I hope someone has a simple answer to this simple question:
  957.  
  958.     In THINK C 5.0, how might one most easily copy an
  959. OSType string into a Str255? I have tried all the obvious(to me)
  960. ways and have had no luck.
  961.                 Thanks in advance,
  962.                 Martin W.
  963.                 am137@po.cwru.edu
  964.                 am137@cleveland.freenet.edu
  965.  
  966.  
  967.  
  968. - -------------------------
  969.  
  970. From: ABSURD@applelink.apple.com (Tim Dierks, ToyMeister, Cray abuser)
  971. Subject:  C String Types
  972. Date: 28 Jan 92 21:25:08 GMT
  973. Organization: MacDTS, Apple Computer
  974.  
  975. In article <1992Jan25.194157.13265@usenet.ins.cwru.edu>, am137@cleveland.Freenet.Edu (Martin Wojbor Woyczynski) writes:
  976. >     In THINK C 5.0, how might one most easily copy an
  977. > OSType string into a Str255? I have tried all the obvious(to me)
  978. > ways and have had no luck.
  979.  
  980.    Because an OSType is 4 characters, you know you want to create a 4-character
  981. string where the 4 characters are the data in the (longword) OSType.  Thus,
  982.  
  983.    OSType      type;
  984.    Str255      text;
  985.  
  986.    [...]
  987.  
  988.    text[0] = 4;                  /* String will be 4 characters long */
  989.    BlockMove(&type,&text[1],4);  /* Move in the characters */
  990.  
  991.    BlockMove is incredible overkill here- it probably takes two or three orders
  992. of magnitude longer to move 4 bytes than is really required, but it demonstrates
  993. the action.  I would have just transferred a long word, like so:
  994.  
  995.    *(long *)&text[1] = type;
  996.  
  997.    but this will generate an address error on 68000 machines, because they cannot
  998. transfer a long word to an odd address, and the string will usually start on an
  999. even boundary, which means the second byte (first after the length) is usually
  1000. at an odd address.
  1001.  
  1002. Hope this helps
  1003. Tim Dierks
  1004. MacDTS, but I speak for myself
  1005.  
  1006.  
  1007.  
  1008. ---------------------------
  1009.  
  1010. From: greeny@top.cis.syr.edu (Jonathan Greenfield)
  1011. Subject: Sending an Apple Event with LaunchApplication...
  1012. Date: 26 Jan 92 00:21:51 GMT
  1013. Organization: CIS Dept., Syracuse University
  1014.  
  1015. The parameter block for LaunchApplication contains a launchAppParameters
  1016. which is a pointer to an AppParameters record:
  1017.  
  1018. type AppParameters=record
  1019.                      theMsgEvent: EventRecord;
  1020.                      eventRefCon: LongInt;
  1021.                      messageLength: LongInt;
  1022.                      messageBuffer: array[0..0] of SignedByte
  1023.                    end;
  1024.  
  1025. I would like to Launch an application sending it an "Open Documents" message
  1026. rather than the default "Open Application" message.  I have successfully
  1027. created and sent Apple Events in the past using the standard AESend posting
  1028. mechanism.  I can't, however, figure out how to send an Apple Event using
  1029. the AppParameters record.
  1030.  
  1031. Could some kind soul please explain to me how this should be done?
  1032.  
  1033. Many thanks.
  1034. --
  1035. greeny                                           greeny@top.cis.syr.edu
  1036.  
  1037. "What's the difference between an orange?"
  1038.  
  1039.  
  1040.  
  1041. - -------------------------
  1042.  
  1043. From: Joe.Francis@dartmouth.edu (Joe Francis)
  1044. Subject:  Sending an Apple Event with LaunchApplication...
  1045. Date: 26 Jan 92 21:51:47 GMT
  1046. Organization: Dartmouth College, Hanover, NH
  1047.  
  1048. In article <1992Jan25.192151.12966@newstand.syr.edu>
  1049. greeny@top.cis.syr.edu (Jonathan Greenfield) writes:
  1050.  
  1051. > I have successfully
  1052. > created and sent Apple Events in the past using the standard AESend posting
  1053. > mechanism.  I can't, however, figure out how to send an Apple Event using
  1054. > the AppParameters record.
  1055.  
  1056. There is a "snippets" folder available on ftp.apple.com for doing
  1057. exactly that.   Look in dts:mac:sc:snippets, I believe.  There are a
  1058. bunch of stuffed folders in there named for the months they were
  1059. released.  I can't remember which one has the sample code you want,
  1060. probably October 91's.
  1061.  
  1062.  
  1063.  
  1064. - -------------------------
  1065.  
  1066. From: dwright@jarthur.claremont.edu (Dan "(" Wright))
  1067. Subject:  Sending an Apple Event with LaunchApplication...
  1068. Date: 29 Jan 92 04:33:55 GMT
  1069. Organization: Harvey Mudd College, Claremont, CA 91711
  1070.  
  1071.  
  1072. Create an odoc AppleEvent, then use AECoerceDesc to convert it into 
  1073. typeAppParameters.
  1074.  
  1075.  
  1076. - Dan
  1077.  
  1078. -- 
  1079.    Dan Wright, Harvey Mudd College, CA:  dwright@sif.claremont.edu
  1080.    
  1081.  
  1082.  
  1083.  
  1084. ---------------------------
  1085.  
  1086. From: mickey@athena.mit.edu (Phrank Yeean Chan)
  1087. Subject: Palettes (Help me get these colors!)
  1088. Date: 26 Jan 92 04:43:58 GMT
  1089. Organization: Massachusetts Institute of Technology
  1090.  
  1091. I have this "pltt" resource (I can use a "CLUT" resource if it helps)
  1092. with 200 colors of the rainbow and 16 greys.  When I open this resource
  1093. in ResEdit, the colors and greys are ordered progressing from red to blue
  1094. and white to black, respectively.
  1095.  
  1096. In my program (Think C), I get this resource and load the palette.  I set up
  1097. a loop from 0 to 255 to display all the colors.  Unfortunately, the colors
  1098. and greys are not ordered anymore.  Actually, they are ordered differently.
  1099. It's as if the Toolbox has selected every 16th color in loading the new colors.
  1100.  
  1101. Does anyone know how I can read the colors in order?  I'm trying to draw
  1102. a gradient, and it's going to be hell if I have to hop around the palette
  1103. to get a set of continuous colors.
  1104.  
  1105. Thanks in advance,
  1106. Frank
  1107. --
  1108. - -----------------------------------------------------------------------
  1109. ()_()  mickey@athena.mit.edu      "Trust me.  I know what I'm doing."
  1110.  (_)   Phrank Yeean Chan             -- Sledge Hammer (1986-1988)
  1111. - -----------------------------------------------------------------------
  1112.  
  1113.  
  1114.  
  1115. - -------------------------
  1116.  
  1117. From: lstein@athena.mit.edu (Lincoln Stein)
  1118. Subject:  Palettes (Help me get these colors!)
  1119. Date: 26 Jan 92 14:35:56 GMT
  1120. Organization: Massachusetts Institute of Technology
  1121.  
  1122. If I understand you rightly you wish to display, in sequence, all the
  1123. colors in a palette resource.  What you should do, then, is something
  1124. like this:
  1125.  
  1126. 1.  In ResEdit, make sure the 'usage' of each of your colors is set to
  1127. pmTolerant, with a tolerance factor of $5000 or less ($0000 if you want
  1128. those exact colors).
  1129.  
  1130. 2.  In your program, call GetNewPalette to fetch a PaletteHandle based
  1131. on the pltt resource.
  1132.  
  1133. 3.  Open up and display a color window, using NewCWindow or
  1134. GetNewCWindow.
  1135.  
  1136. 4.  Call SetPalette with your palette handle and color window to
  1137. associate them.  From now on, the palette will become active whenever
  1138. the window sees an activate event.  If necessary, the system will swap
  1139. the palette's colors into the system clut, causing a colorful
  1140. background flash.
  1141.  
  1142. 5.  To display the colors, loop from index 0 to the number of colors
  1143. in the palette - 1.  For each index call PmForeColor(index).  Then
  1144. draw a filled rectangle, or whatever.
  1145.  
  1146. 6.  When done with the palette, call DisposePalette to release its
  1147. colors.
  1148.  
  1149. ========================================================================
  1150. Lincoln D. Stein            Brigham & Women's Hospital
  1151. lstein@hstbme.mit.edu            Boston, MA
  1152. ========================================================================
  1153.  
  1154.  
  1155.  
  1156. - -------------------------
  1157.  
  1158. From: mbabramowicz@amherst.edu
  1159. Subject:  Palettes (Help me get these colors!)
  1160. Date: 26 Jan 92 11:30:52 GMT
  1161. Organization: Amherst College, Amherst, MA.
  1162.  
  1163. In article <1992Jan26.044358.15263@athena.mit.edu>, mickey@athena.mit.edu (Phrank Yeean Chan) writes:
  1164. > I have this "pltt" resource (I can use a "CLUT" resource if it helps)
  1165. > with 200 colors of the rainbow and 16 greys.  When I open this resource
  1166. > in ResEdit, the colors and greys are ordered progressing from red to blue
  1167. > and white to black, respectively.
  1168. > In my program (Think C), I get this resource and load the palette.  I set up
  1169. > a loop from 0 to 255 to display all the colors.  Unfortunately, the colors
  1170. > and greys are not ordered anymore.  Actually, they are ordered differently.
  1171. > It's as if the Toolbox has selected every 16th color in loading the new colors.
  1172. > Does anyone know how I can read the colors in order?  I'm trying to draw
  1173. > a gradient, and it's going to be hell if I have to hop around the palette
  1174. > to get a set of continuous colors.
  1175. > Thanks in advance,
  1176. > Frank
  1177. > --
  1178. > -------------------------------------------------------------------------
  1179. > ()_()  mickey@athena.mit.edu      "Trust me.  I know what I'm doing."
  1180. >  (_)   Phrank Yeean Chan             -- Sledge Hammer (1986-1988)
  1181. > -------------------------------------------------------------------------
  1182.  
  1183.  
  1184.  
  1185. The situation you describe seems very odd to me, because when I worked
  1186. with the Palette Manager, and used GetEntryColor to load colors from
  1187. the palette, they did load in the same order I had placed them...
  1188. Maybe you are misdiagnosing the problem?
  1189.  
  1190.  
  1191.  
  1192. ---------------------------
  1193.  
  1194. From: scott@phylo.life.uiuc.edu (Scott Howard)
  1195. Subject: sqrt call using (in)SANE
  1196. Date: 26 Jan 92 07:00:10 GMT
  1197. Organization: University of Illinois at Urbana
  1198.  
  1199. This must seem like a lazy/stupid question, but after spending the
  1200. last 9 hours trying to get it myself, I figure its easier to post a 
  1201. query here than to pay for the monitor I'm going to kick in. :-)
  1202.  
  1203. What exactly is wrong with this statement:
  1204.  
  1205. GalaxyData[galaxy].StarData[star].Velocity[xyz] =
  1206.  (sqrt((Target_MassUnits/Distance_from_Galactic_Center));
  1207.  
  1208. The element Velocity is declared as a long double, the two labels on
  1209. the right hand side of the assignment are Constants declared as integral
  1210. values. The compiler flags this line, the first statement in a for loop: 
  1211. I am #including <SANE.h>, followed by <Math.h>, with 020 and 881 code
  1212. generation options on.
  1213.  
  1214. Excess verbiage ahead, hit 'next'
  1215.  
  1216. Any and all casting I've attempted with this delightful assignment
  1217. statement have produced identical results. Kudos to any and all suggestions
  1218. in advance (and a large raspberry to building number one in Cupertino
  1219. for forcing casual programmers to buy yet another manual just to 
  1220. get a crack at one or two simple transcendental functions.)
  1221.  
  1222. --
  1223. All views expressed are copyright 1992 Scott Howard. Any resemblance to
  1224. living persons, historical events, or logically constructed arguements
  1225. are purely unintentional.
  1226.  
  1227.  
  1228.  
  1229. - -------------------------
  1230.  
  1231. From: ralph@mso.anu.edu (Ralph Sutherland)
  1232. Subject:  sqrt call using (in)SANE
  1233. Date: 26 Jan 92 23:48:22 GMT
  1234. Organization: Mt. Stromlo Observatory
  1235.  
  1236. >    scott@phylo.life.uiuc.edu (Scott Howard) aksed:
  1237. >
  1238. >    What exactly is wrong with this statement:
  1239. >
  1240. >    GalaxyData[galaxy].StarData[star].Velocity[xyz] =
  1241. >    (sqrt((Target_MassUnits/Distance_from_Galactic_Center));
  1242. ........^.......................................................
  1243.  
  1244. Have you counted your brackets?!?
  1245.  
  1246. cheers
  1247. ralph
  1248.  
  1249.  
  1250.  
  1251. -- 
  1252. - -- Ralph S. Sutherland      Mount Stromlo & Siding Spring Observatories.
  1253. - -- ralph@madras.anu.edu.au  The Australian National University.
  1254. - -- rss100@csc2.anu.edu.au   --------------------------------------------
  1255.  
  1256.  
  1257.  
  1258. - -------------------------
  1259.  
  1260. From: scott@phylo.life.uiuc.edu (Scott Howard)
  1261. Subject: sqrt SUMMARY and Thanks.
  1262. Date: 27 Jan 92 14:54:46 GMT
  1263. Organization: University of Illinois at Urbana
  1264.  
  1265. As everyone correctly pointed out, I mistyped
  1266. the brackets. My source does have the correct number however.
  1267.  
  1268. The problem I encountered stems from the '881 code generation
  1269. option- one cannot have '881 and SANE overlapping. Since I need
  1270. to generate '881 code from time to time in my project, I'll
  1271. try isolating the calls in the functions that need it and 
  1272. use #pragma directives. 
  1273.  
  1274. Thanks again for all the responses.
  1275.  
  1276. --
  1277. All views expressed are copyright 1992 Scott Howard. Any resemblance to
  1278. living persons, historical events, or logically constructed arguements
  1279. is purely unintentional.
  1280.  
  1281.  
  1282.  
  1283. - -------------------------
  1284.  
  1285. From: gmarzot@mitre.org (G. S. Marzot (Joe))
  1286. Subject:  sqrt call using (in)SANE
  1287. Date: 27 Jan 92 14:49:26 GMT
  1288. Organization: The MITRE Corporation
  1289.  
  1290. In article <scott.696409224@phylo> scott@phylo.life.uiuc.edu (Scott 
  1291. Howard) writes:
  1292. > GalaxyData[galaxy].StarData[star].Velocity[xyz] =
  1293. >  (sqrt((Target_MassUnits/Distance_from_Galactic_Center));
  1294. ...
  1295. > The compiler flags this line, the first statement in a for loop: 
  1296. > I am #including <SANE.h>, followed by <Math.h>, with 020 and 881 code
  1297. > generation options on.
  1298.  
  1299. I believe you should include math.h before SANE.h because the SANE version 
  1300. wants an Extended type which may be different from long double. Check out 
  1301. the use of native floating point compiler option versus unversal floating 
  1302. point in Think C ( I assume you are using 5.0 or greater). I find using 
  1303. native FP and 020/881 is the fastest and I rarely am forced to use the 
  1304. SANE versions of math calls but when I do I just convert from the 96bit FP 
  1305. format to the 80bit SANE extended format  before the SANE call and then 
  1306. back after.
  1307. -GSM
  1308.  
  1309.  
  1310. Email: gmarzot@linus.mitre.org
  1311.  
  1312. (standard  disclaimer)
  1313.  
  1314.  
  1315.  
  1316. - -------------------------
  1317.  
  1318. From: ABSURD@applelink.apple.com (Tim Dierks, ToyMeister, Cray abuser)
  1319. Subject:  sqrt SUMMARY and Thanks.
  1320. Date: 28 Jan 92 21:03:34 GMT
  1321. Organization: MacDTS, Apple Computer
  1322.  
  1323. In article <scott.696524100@phylo>, scott@phylo.life.uiuc.edu (Scott Howard) writes:
  1324. > The problem I encountered stems from the '881 code generation
  1325. > option- one cannot have '881 and SANE overlapping. Since I need
  1326. > to generate '881 code from time to time in my project, I'll
  1327. > try isolating the calls in the functions that need it and 
  1328. > use #pragma directives. 
  1329.  
  1330. This is one of the most difficult things to construct on the Mac at the
  1331. moment; a program that uses 881 or SANE as required.  (Forgive me if that
  1332. wasn't the original intent).  It's complicated by the fact that they must
  1333. use seperate libraries for all their math functions, which is only
  1334. compounded by the fact that they use different floating point types-
  1335. even the _size_ of the extended type changes from '881 code to SANE.
  1336. This makes it extremely difficult to mix the two types of code.
  1337. Unfortunately, this is currently a problem without a solution; if anyone
  1338. has good techniques for working around these difficulties, I'd love to
  1339. hear them.
  1340.  
  1341. Tim Dierks
  1342. MacDTS, but I speak for myself
  1343.  
  1344.  
  1345.  
  1346. - -------------------------
  1347.  
  1348. From: orpheus@reed.edu (P. Hawthorne)
  1349. Subject: SANE or Sadie One (was Re: sqrt SUMMARY and Thanks.)
  1350. Date: 31 Jan 92 02:21:48 GMT
  1351. Organization: Reed College, Portland OR
  1352.  
  1353.  
  1354.   ABSURD@applelink.apple.com (Tim Dierks, ToyMeister, Cray abuser) writes:
  1355. . This is one of the most difficult things to construct on the Mac at the
  1356. . moment; a program that uses 881 or SANE as required....
  1357. . Unfortunately, this is currently a problem without a solution.
  1358.  
  1359.   It requires some care just to make a program which uses a 6888n and can
  1360. warn the user if they don't have one. Adapting the program to whatever
  1361. happens to be available does seem a worthy goal, if somewhat ambitious.
  1362. It would mean stepping on the toes of mighty Microsoft Excel, so I'm in.
  1363.   Doesn't Excel do this? How does it do it? Is there a better way?
  1364.   What does PseudoFPU do again? Never downloaded it, since I have an FPU.
  1365.  
  1366.  
  1367. . It's complicated by the fact that they must use seperate libraries for
  1368. . all their math functions... 
  1369.  
  1370.   In an application I am writing, the user can roll their own atomic data
  1371. types and just provide the app with a module file. The module is called
  1372. at the appropriate times, but the internal data types are assuming the
  1373. existence of a math coprocessor.
  1374.   To tell the truth, I have been assuming the existence of math hardware
  1375. for a good long while now. It has to do with being a speed freak, I think.
  1376. If there is a good way to condescend to the lowest common denominator,
  1377. I would be disappointed to think that it would significantly affect the
  1378. performance for the highest.
  1379.   Perhaps a given application should jump to an offset from a given
  1380. code resource, whichever one happens to be loaded into a global variable.
  1381. The application could determine which resource to load at launch time.
  1382. I did, however, notice that there has been some success with modifying the
  1383. jump table. A practical idea?
  1384.  
  1385.  
  1386. . Which is only compounded by the fact that they use different floating
  1387. . point types... Even the size of the extended type changes from '881 code
  1388. . to SANE.
  1389.  
  1390.   So much for strong typing. It's one of those things that the Sadie One
  1391. book from Motorola doesn't give any hints for. This is the fly in the
  1392. ointment, IMHO from a higher level perspective. 
  1393.   Just out of curiosity, why doesn't SANE use the same extended real data
  1394. format as the hardware does? Not griping about SANE, of course, but isn't
  1395. it a possibility?
  1396.  
  1397.  
  1398.   Theus
  1399.   orpheus@reed.edu
  1400.  
  1401.  
  1402.  
  1403. - -------------------------
  1404.  
  1405. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  1406. Subject:  SANE or Sadie One
  1407. Date: 1 Feb 92 06:08:13 GMT
  1408. Organization: University of Waikato, Hamilton, New Zealand
  1409.  
  1410. In article <1992Jan31.022148.20407@reed.edu>, orpheus@reed.edu (P. Hawthorne)
  1411. asks:
  1412.  
  1413. >   Just out of curiosity, why doesn't SANE use the same extended real data
  1414. > format as the hardware does? Not griping about SANE, of course, but isn't
  1415. > it a possibility?
  1416.  
  1417. Could it be because SANE came out somewhat before the 68881 did?
  1418.  
  1419. Shouldn't the question be the other way around? Why didn't Motorola
  1420. stick to 80-byte reals, why did they *have* to put in that extra unused
  1421. word and cause all these compatibility problems?
  1422.  
  1423. I don't buy the "alignment" argument. If I want to align things for
  1424. speed, I'm perfectly capable of doing it myself.
  1425.  
  1426. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  1427. Computer Services Dept                     fax: +64-7-838-4066
  1428. University of Waikato            electric mail: ldo@waikato.ac.nz
  1429. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
  1430. To someone with a hammer and a screwdriver, every problem looks
  1431. like a nail with threads.
  1432.  
  1433.  
  1434.  
  1435. - -------------------------
  1436.  
  1437. From: orpheus@reed.edu (P. Hawthorne)
  1438. Subject:  SANE or Sadie One
  1439. Date: 31 Jan 92 07:17:18 GMT
  1440. Organization: Reed College, Portland OR
  1441.  
  1442.  
  1443.   orpheus@reed.edu (Theus) asks: 
  1444. : Just out of curiosity, why doesn't SANE use the same extended real data
  1445. : format as the hardware does? 
  1446.  
  1447.   ldo@waikato.ac.nz (Lawrence D'Oliveiro) counters:
  1448. : Shouldn't the question be the other way around? Why didn't Motorola
  1449. : stick to 80-byte reals, why did they *have* to put in that extra unused
  1450. : word and cause all these compatibility problems?
  1451.  
  1452.   Legend has it that SANE was informally the model for the IEEE Standard
  1453. for Binary Floating Point Arithmetic, upon which Sadie was based. Given
  1454. how Motorola just loves longword alignment, maybe the reason for the
  1455. 64-bit mantissa was to take advantage of what would otherwise have been
  1456. wasted bits in the instruction stream. Those 80-bit registers in the Sadie
  1457. would have been prime for software SANEs extended format. Sigh.
  1458.  
  1459.   I wonder if we are making too much of this issue. Aside from being able
  1460. to convert between the formats when appropriate, which is easy, how can a
  1461. single application use either hardware or SANE without sacrificing
  1462. performance if the hardware is present?
  1463.  
  1464.   Theus (orpheus@reed.edu)
  1465.  
  1466.  
  1467.  
  1468. - -------------------------
  1469.  
  1470. From: neeri@jupiter.ethz.ch (Matthias Ulrich Neeracher)
  1471. Subject:  SANE or Sadie One
  1472. Date: 31 Jan 92 22:12:31 GMT
  1473. Organization: Integrated Systems Laboratory, ETH, Zurich
  1474.  
  1475. In article <1992Jan31.071718.11583@reed.edu> orpheus@reed.edu (P. Hawthorne) writes:
  1476. >  I wonder if we are making too much of this issue. Aside from being able
  1477. >to convert between the formats when appropriate, which is easy, how can a
  1478. >single application use either hardware or SANE without sacrificing
  1479. >performance if the hardware is present?
  1480.  
  1481. I wonder that noone has mentioned this so far, but don't there exist utilities
  1482. like Omega SANE which replace SANE calls with coprocessor instructions (i.e.
  1483. the first time an applications makes a SANE call, the call is inline replaced
  1484. by 6888X instructions) ? Apart from being ugly, this solution seems to work
  1485. well enough.
  1486.  
  1487. Matthias
  1488.  
  1489. - ---
  1490. Matthias Neeracher                                   neeri@iis.ethz.ch
  1491.  "You must have picked up that copy of Scarlett instead of Inside Mac
  1492.   when you tried to find the right call..." -- Keith Rollin
  1493.  
  1494.  
  1495.  
  1496. - -------------------------
  1497.  
  1498. From: keith@Apple.COM (Keith Rollin)
  1499. Subject:  SANE or Sadie One
  1500. Date: 3 Feb 92 03:18:51 GMT
  1501. Organization: Apple Computer Inc., Cupertino, CA
  1502.  
  1503. In article <NEERI.92Jan31141231@jupiter.ethz.ch> neeri@jupiter.ethz.ch (Matthias Ulrich Neeracher) writes:
  1504. >In article <1992Jan31.071718.11583@reed.edu> orpheus@reed.edu (P. Hawthorne) writes:
  1505. >>  I wonder if we are making too much of this issue. Aside from being able
  1506. >>to convert between the formats when appropriate, which is easy, how can a
  1507. >>single application use either hardware or SANE without sacrificing
  1508. >>performance if the hardware is present?
  1509. >
  1510. >I wonder that noone has mentioned this so far, but don't there exist utilities
  1511. >like Omega SANE which replace SANE calls with coprocessor instructions (i.e.
  1512. >the first time an applications makes a SANE call, the call is inline replaced
  1513. >by 6888X instructions) ? Apart from being ugly, this solution seems to work
  1514. >well enough.
  1515.  
  1516. Just a note of clarification: Omega SANE doesn't replace calls to SANE
  1517. with equivalent FPU instructions. Instead, it modifies the jump to the
  1518. common SANE entry point with a jump directly to the right routine. This
  1519. is similar to replacing A-Trap instructions with the result of
  1520. GetTrapAddress.
  1521.  
  1522. There are other INITs that allow one to compile an application with FPU
  1523. instructions and then run them on machines lacking an FPU. These INITs
  1524. trap the FPU instructions on those machines, and route them to SANE to
  1525. be emulated.
  1526.  
  1527. >
  1528. >-----
  1529. >Matthias Neeracher                                   neeri@iis.ethz.ch
  1530. > "You must have picked up that copy of Scarlett instead of Inside Mac
  1531. >  when you tried to find the right call..." -- Keith Rollin
  1532.  
  1533. Oops! Looks like I made an impression on someone! I wonder if this is
  1534. good or bad...
  1535.  
  1536. -- 
  1537. - ----------------------------------------------------------------------------
  1538. Keith Rollin           ---            <Taligent .signature under construction>
  1539. Disclaimer: Pretty soon, I really _won't_ be speaking for Apple...
  1540.  
  1541.  
  1542.  
  1543. - -------------------------
  1544.  
  1545. From: ksand@apple.com (Kent Sandvik)
  1546. Subject:  SANE or Sadie One (was Re: sqrt SUMMARY and Thanks.)
  1547. Date: 2 Feb 92 23:43:13 GMT
  1548. Organization: MacDTS Mongols
  1549.  
  1550. In article <1992Jan31.022148.20407@reed.edu>, orpheus@reed.edu (P. Hawthorne) writes:
  1551. >   ABSURD@applelink.apple.com (Tim Dierks, ToyMeister, Cray abuser) writes:
  1552. > .. This is one of the most difficult things to construct on the Mac at the
  1553. > .. moment; a program that uses 881 or SANE as required....
  1554. > .. Unfortunately, this is currently a problem without a solution.
  1555. >   It requires some care just to make a program which uses a 6888n and can
  1556. > warn the user if they don't have one. Adapting the program to whatever
  1557. > happens to be available does seem a worthy goal, if somewhat ambitious.
  1558. > It would mean stepping on the toes of mighty Microsoft Excel, so I'm in.
  1559. >   Doesn't Excel do this? How does it do it? Is there a better way?
  1560. >   What does PseudoFPU do again? Never downloaded it, since I have an FPU.
  1561. > .. It's complicated by the fact that they must use seperate libraries for
  1562. > .. all their math functions... 
  1563.  
  1564. Yes, we have talked about this back and forth inside DTS, and the easy,
  1565. quick and less-resource taking way is to ship *two* binaries, one for
  1566. 68881/2 direct op-codes, and one using SANE.
  1567.  
  1568. You might do all kinds of tricks using abstraction barriers (glue
  1569. code which calls real calls, canonical data structures, and so on...) -
  1570. but in the long run, is it worth the time?
  1571.  
  1572. Kent Sandvik
  1573. (setq disclaimer "not-speaking-for-Apple")
  1574.  
  1575.  
  1576.  
  1577. - -------------------------
  1578.  
  1579. From: ABSURD@applelink.apple.com (Tim Dierks, Cray abuser)
  1580. Subject:  SANE or Sadie One (was Re: sqrt SUMMARY and Thanks.)
  1581. Date: 3 Feb 92 21:48:37 GMT
  1582. Organization: MacDTS, Apple Computer
  1583.  
  1584. In article <1992Jan31.022148.20407@reed.edu>, orpheus@reed.edu (P. Hawthorne) writes:
  1585. >   To tell the truth, I have been assuming the existence of math hardware
  1586. > for a good long while now. It has to do with being a speed freak, I think.
  1587. > If there is a good way to condescend to the lowest common denominator,
  1588. > I would be disappointed to think that it would significantly affect the
  1589. > performance for the highest.
  1590.  
  1591. A note I should make here is that Motorola has announced a chip called
  1592. the 68040LC, which is a 68040 without a math coprocessor.  This would
  1593. result in a CPU with relatively good integer performance (representing
  1594. 90%+ of applications), but relatively poor floating point performace.
  1595. There is some possibility that Apple may at some point release a machine
  1596. which uses this chip- thus, developers of high-end applications may want
  1597. to seriously consider adding support for non-FPU machines.
  1598.  
  1599. Tim Dierks
  1600. MacDTS, but I speak for myself
  1601.  
  1602.  
  1603.  
  1604. - -------------------------
  1605.  
  1606. From: ABSURD@applelink.apple.com (Tim Dierks, Cray abuser)
  1607. Subject:  SANE or Sadie One (was Re: sqrt SUMMARY and Thanks.)
  1608. Date: 3 Feb 92 21:48:41 GMT
  1609. Organization: MacDTS, Apple Computer
  1610.  
  1611. In article <1992Jan31.022148.20407@reed.edu>, orpheus@reed.edu (P. Hawthorne) writes:
  1612. >   To tell the truth, I have been assuming the existence of math hardware
  1613. > for a good long while now. It has to do with being a speed freak, I think.
  1614. > If there is a good way to condescend to the lowest common denominator,
  1615. > I would be disappointed to think that it would significantly affect the
  1616. > performance for the highest.
  1617.  
  1618. A note I should make here is that Motorola has announced a chip called
  1619. the 68040LC, which is a 68040 without a math coprocessor.  This would
  1620. result in a CPU with relatively good integer performance (representing
  1621. 90%+ of applications), but relatively poor floating point performace.
  1622. There is some possibility that Apple may at some point release a machine
  1623. which uses this chip- thus, developers of high-end applications may want
  1624. to seriously consider adding support for non-FPU machines.
  1625.  
  1626. Tim Dierks
  1627. MacDTS, but I speak for myself
  1628.  
  1629.  
  1630.  
  1631. - -------------------------
  1632.  
  1633. From: lim@iris.ucdavis.edu (Lloyd Lim)
  1634. Subject:  SANE or Sadie One
  1635. Date: 4 Feb 92 00:54:02 GMT
  1636. Organization: U.C. Davis - Department of Electrical Engineering and Computer Science
  1637.  
  1638. In article <1992Jan31.071718.11583@reed.edu> orpheus@reed.edu (P. Hawthorne) writes:
  1639. >
  1640. >  I wonder if we are making too much of this issue. Aside from being able
  1641. >to convert between the formats when appropriate, which is easy, how can a
  1642. >single application use either hardware or SANE without sacrificing
  1643. >performance if the hardware is present?
  1644.  
  1645. The key phrase is "without sacrificing performance".  You have to have
  1646. two different sets of code, one with 68881 instructions and one without.
  1647. It's a hassle to do this in one program.
  1648.  
  1649. THINK C 5.x has an interesting Universal format.  It's 96 bits just like
  1650. the 68881 format but it copies the exponent part to the unused word also.
  1651. The conversions make it a bit slower and you still have to convert (to
  1652. change sizes) when you call SANE.
  1653.  
  1654. If you could get rid of the automatic conversions and just explicitly
  1655. convert when you need to (which isn't very often), this seems like an
  1656. ideal data type to use.  To go from 96 to 80, you'd just copy one word
  1657. and use a different pointer.  This can be done in one instruction.
  1658. I haven't really done this so I could be leaving out a few things...
  1659.  
  1660. +++
  1661. Lloyd Lim     Internet: lim@iris.cs.ucdavis.edu
  1662.               America Online: LimUnltd
  1663.               Compuserve: 72647,660
  1664.               US Mail: 224 Lysle Leach Hall, U.C. Davis, Davis, CA 95616
  1665.  
  1666.  
  1667.  
  1668. ---------------------------
  1669.  
  1670. End of C.S.M.P. Digest
  1671. **********************
  1672.